<template>
  <div>
    <p>1. 获取所有图书信息</p>
    <button @click="getAllFn">点击-查看控制台</button>
  </div>
</template>

<script>
// 1. 下载axios
// 2. 引入axios
// 3. 发起axios请求

//导入
import axios from "axios";
export default {
  methods: {
    getAllFn() {
      /* axios({
        method: "Get",
        url: "http://123.57.109.30:3006/api/getbooks",
      }).then((res) => {
        console.log(res);
      }); */
      //axios返回值是promise对象
      const p1 = axios({
        method: "Get",
        url: "http://123.57.109.30:3006/api/getbooks",
      });
      console.log(p1);
      p1.then((res) => {
        console.log(res);
      });
    },
  },
};
</script>

<style>
</style>